<template>
	<div class="mg-tb">
		<div class="title">
			<h4 v-text="info.title"></h4>
			<p>{{info.add_time | datefmt('YYYY-MM-DD HH-mm-ss')}}</p>
		</div>
		<div class="content" v-html="info.content">
	
		</div>
		<!-- 2.实现评论组件的集成 -->
		<!-- 使用评论组件 -->
		<comment :id="id"></comment>
	</div>
</template>

<script>
import { Toast } from 'mint-ui';
import common from "../../kits/Common.js";
// 1.导入评论组件comment.vue
import comment from '../subcom/comment.vue';

export default {
	components: {
		comment  //1.5 注册评论组件
	},
	data() {
		return {
			id: 0,//传入id
			info: {
				// "id": 13,
				// "title": "1季度多家房企利润跌幅超50% 去库存促销战打响",
				// "click": 1,
				// "add_time": "2015-04-16T03:50:28.000Z",
				// "content": "2123"
			}
		}
	},
	created() {
		this.id = this.$route.params.id;
		this.getInfo()
	},
	methods: {
		getInfo() {
			var url = common.apidomain + "/api/getnew/" + this.id;
			this.$http.get(url)
				.then(function (res) {
					var newsInfo = res.body;
					if (newsInfo.status != 0) {
						Toast(newsInfo.message);
						return
					}

					this.info = newsInfo.message[0]
				})
		}
	}
}
</script>

<style scoped>

</style>